package com.dejavu.c4.service.impl;

import com.dejavu.c4.mapper.UserMapper;
import com.dejavu.c4.pojo.User;
import com.dejavu.c4.service.UserService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserById(int userId) {
        return userMapper.findUserById(userId);
    }

    @Override
    public User findUserByEmail(User user) {
        return userMapper.findUserByEmail(user);
    }

    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public List<User> findUserByMany(int page,int size,User user) {
        PageHelper.startPage(page,size);
        return userMapper.findUserByMany(user);
    }

    @Override
    public User checkUser(String email, String phone) {
        return userMapper.checkUser(email,phone);
    }

    @Override
    public int regist(User user) {
        return userMapper.regist(user);
    }

    @Override
    public int deleteUser(List<User> users) {
        return userMapper.deleteUser(users);
    }

    @Override
    public int personalUpdate(User user) {
        return userMapper.personalUpdate(user);
    }
}
